package entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * MontantCaisse entity.
 *
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "montant_caisse", schema = "public")
public class MontantCaisse implements java.io.Serializable {

    // Fields
    private Integer id;
    private Guichet guichet;
    private double montant;
    private Set<ArretCaisse> arretCaisses = new HashSet<ArretCaisse>(0);
    private Integer last;
    private Integer last2;
    // Constructors

    /**
     * default constructor
     */
    public MontantCaisse() {
    }

    /**
     * full constructor
     */
    public MontantCaisse(Guichet guichet, double montant,
            Set<ArretCaisse> arretCaisses) {
        this.guichet = guichet;
        this.montant = montant;
        this.arretCaisses = arretCaisses;
    }

    // Property accessors
    @GenericGenerator(name = "generator", strategy = "increment")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_guichet")
    public Guichet getGuichet() {
        return this.guichet;
    }

    public void setGuichet(Guichet guichet) {
        this.guichet = guichet;
    }

    @Column(name = "montant", precision = 17, scale = 17)
    public double getMontant() {
        return this.montant;
    }

    public void setMontant(double montant) {
        this.montant = montant;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "montantCaisse")
    public Set<ArretCaisse> getArretCaisses() {
        return this.arretCaisses;
    }

    public void setArretCaisses(Set<ArretCaisse> arretCaisses) {
        this.arretCaisses = arretCaisses;
    }

    @Column(name = "last")
    public Integer getLast() {
        return last;
    }

    public void setLast(Integer last) {
        this.last = last;
    }

    @Column(name = "last2")
    public Integer getLast2() {
        return last2;
    }

    public void setLast2(Integer last2) {
        this.last2 = last2;
    }
}